<script setup>
import { ref } from 'vue'
import HeaderBar from '@/components/HeaderBar.vue'
import CreditLevelChart from '@/components/CreditLevelChart.vue'
import RepairTrendChart from '@/components/RepairTrendChart.vue'
import DepartmentScoreChart from '@/components/DepartmentScoreChart.vue'
import CreditCollectionChart from '@/components/CreditCollectionChart.vue'
import CreditRanking from '@/components/CreditRanking.vue'
import RedlistPanel from '@/components/RedlistPanel.vue'
import BlacklistPanel from '@/components/BlacklistPanel.vue'

const totalEnterprises = ref(1000)
const warningEnterprises = ref(50)
const seriousBreachEnterprises = ref(10)

const currentTime = ref(new Date().toLocaleString('zh-CN', {
  year: 'numeric',
  month: 'long',
  day: 'numeric',
  hour: '2-digit',
  minute: '2-digit',
  second: '2-digit',
  weekday: 'long'
}))

// 更新时间
setInterval(() => {
  currentTime.value = new Date().toLocaleString('zh-CN', {
    year: 'numeric',
    month: 'long',
    day: 'numeric',
    hour: '2-digit',
    minute: '2-digit',
    second: '2-digit',
    weekday: 'long'
  })
}, 1000)
</script>

<template>
  <div class="screen-container">
    <header-bar 
      :total-enterprises="totalEnterprises"
      :warning-enterprises="warningEnterprises"
      :serious-breach-enterprises="seriousBreachEnterprises"
    />
    
    <div class="main-content">
      <div class="left-group">
        <div class="stats-card">
          <div class="stat-item">
            <div class="circle-wrap blue">
              <div class="circle-value">{{ totalEnterprises }}家</div>
            </div>
            <div class="stat-info">
              <div class="label">园区企业总数</div>
              <div class="value">入驻企业总量</div>
            </div>
          </div>
          <div class="stat-item">
            <div class="circle-wrap warning">
              <div class="circle-value">{{ warningEnterprises }}家</div>
            </div>
            <div class="stat-info">
              <div class="label">预警企业数量</div>
              <div class="value">需要重点关注</div>
            </div>
          </div>
          <div class="stat-item">
            <div class="circle-wrap danger">
              <div class="circle-value">{{ seriousBreachEnterprises }}家</div>
            </div>
            <div class="stat-info">
              <div class="label">严重失信企业</div>
              <div class="value">失信记录</div>
            </div>
          </div>
        </div>

        <credit-ranking class="ranking-chart chart-item">
          <div class="corner-tl"></div>
          <div class="corner-tr"></div>
          <div class="corner-bl"></div>
          <div class="corner-br"></div>
          <div class="chart-title">企业信用排行榜</div>
        </credit-ranking>
      </div>
      
      <div class="center-group">
        <div class="main-charts">
          <repair-trend-chart class="main-chart chart-item">
            <div class="corner-tl"></div>
            <div class="corner-tr"></div>
            <div class="corner-bl"></div>
            <div class="corner-br"></div>
          </repair-trend-chart>

          <credit-collection-chart class="main-chart chart-item">
            <div class="corner-tl"></div>
            <div class="corner-tr"></div>
            <div class="corner-bl"></div>
            <div class="corner-br"></div>
          </credit-collection-chart>
        </div>

        <div class="sub-charts">
          <credit-level-chart class="pie-chart chart-item">
            <div class="corner-tl"></div>
            <div class="corner-tr"></div>
            <div class="corner-bl"></div>
            <div class="corner-br"></div>
          </credit-level-chart>
          
          <department-score-chart class="distribution-chart chart-item">
            <div class="corner-tl"></div>
            <div class="corner-tr"></div>
            <div class="corner-bl"></div>
            <div class="corner-br"></div>
          </department-score-chart>
        </div>
      </div>
      
      <div class="right-group">
        <div class="list-panels">
          <div class="redlist-container chart-item">
            <div class="panel-header">
              <i class="fas fa-award"></i>
              <span>红名单企业</span>
            </div>
            <redlist-panel />
          </div>
          
          <div class="blacklist-container chart-item">
            <div class="panel-header">
              <i class="fas fa-exclamation-triangle"></i>
              <span>黑名单企业</span>
            </div>
            <blacklist-panel />
          </div>
        </div>
      </div>
      
      <div class="bottom-group">
        <credit-ranking class="profit-analysis chart-item">
          <div class="corner-tl"></div>
          <div class="corner-tr"></div>
          <div class="corner-bl"></div>
          <div class="corner-br"></div>
          <div class="chart-title">信用评级</div>
        </credit-ranking>
        
        <repair-trend-chart class="trend-analysis chart-item">
          <div class="corner-tl"></div>
          <div class="corner-tr"></div>
          <div class="corner-bl"></div>
          <div class="corner-br"></div>
          <div class="chart-title">修复趋势</div>
        </repair-trend-chart>
      </div>
    </div>
  </div>
</template>

<style scoped lang="scss">
.screen-container {
  min-height: 100vh;
  height: 100vh;
  background: linear-gradient(135deg, #001B3D 0%, #000B1A 100%);
  color: #E2E8F0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  
  &::before {
    content: '';
    position: absolute;
    inset: 0;
    background: 
      radial-gradient(circle at 20% 20%, rgba(0, 255, 255, 0.08) 0%, transparent 50%),
      radial-gradient(circle at 80% 80%, rgba(0, 150, 255, 0.08) 0%, transparent 50%),
      repeating-linear-gradient(90deg, transparent, transparent 50px, rgba(0, 255, 255, 0.03) 50px, rgba(0, 255, 255, 0.03) 51px),
      repeating-linear-gradient(0deg, transparent, transparent 50px, rgba(0, 255, 255, 0.03) 50px, rgba(0, 255, 255, 0.03) 51px);
    pointer-events: none;
    opacity: 0.8;
    animation: pulse 4s ease-in-out infinite;
  }

  &::after {
    content: '';
    position: absolute;
    inset: 0;
    background: 
      linear-gradient(90deg, transparent 0%, rgba(0, 255, 255, 0.05) 50%, transparent 100%),
      linear-gradient(180deg, transparent 0%, rgba(0, 150, 255, 0.05) 50%, transparent 100%);
    pointer-events: none;
    animation: scanline 8s linear infinite;
  }
}

.main-content {
  flex: 1;
  display: grid;
  grid-template-columns: 380px 1fr 380px;
  grid-template-rows: 1fr auto;
  gap: 24px;
  padding: 24px;
  position: relative;
  height: calc(100vh - 60px);
  overflow: hidden;
  
  &::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    height: 2px;
    background: linear-gradient(90deg, 
      transparent 0%,
      rgba(0, 255, 255, 0.5) 50%,
      transparent 100%
    );
  }
}

.left-group {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 24px;
  max-height: calc(100vh - 100px);
  position: relative;
  
  &::before {
    content: '';
    position: absolute;
    left: -12px;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(180deg,
      rgba(0, 255, 255, 0.8),
      rgba(0, 150, 255, 0.2),
      transparent
    );
    border-radius: 1.5px;
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.3);
  }
  
  .stats-card {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    background: rgba(0, 20, 60, 0.85);
    padding: 24px;
    border-radius: 16px;
    position: relative;
    backdrop-filter: blur(12px);
    border: 1px solid rgba(0, 255, 255, 0.2);
    box-shadow: 0 0 40px rgba(0, 150, 255, 0.15);
    
    &::before {
      content: '';
      position: absolute;
      inset: 0;
      border-radius: 16px;
      padding: 1.5px;
      background: linear-gradient(135deg, 
        rgba(0, 255, 255, 0.7),
        transparent 50%,
        rgba(0, 150, 255, 0.5)
      );
      mask: linear-gradient(#fff 0 0) content-box, 
            linear-gradient(#fff 0 0);
      -webkit-mask-composite: xor;
      mask-composite: exclude;
      pointer-events: none;
    }

    .stat-item {
      display: flex;
      align-items: center;
      gap: 20px;
      padding: 20px;
      background: rgba(0, 40, 80, 0.5);
      border-radius: 12px;
      transition: all 0.3s ease;
      position: relative;
      overflow: hidden;
      border: 1px solid rgba(255, 255, 255, 0.1);
      
      &::before {
        content: '';
        position: absolute;
        inset: 0;
        background: linear-gradient(90deg,
          transparent,
          rgba(0, 255, 255, 0.15),
          transparent
        );
        transform: translateX(-100%);
        transition: transform 0.5s ease;
      }
      
      &::after {
        content: '';
        position: absolute;
        right: 0;
        top: 0;
        bottom: 0;
        width: 4px;
        background: linear-gradient(180deg,
          transparent,
          var(--highlight-color, rgba(0, 255, 255, 0.6)),
          transparent
        );
        opacity: 0;
        transition: opacity 0.3s ease;
      }
      
      &:hover {
        transform: translateX(8px);
        background: rgba(0, 60, 100, 0.5);
        
        &::before {
          transform: translateX(100%);
        }
        
        &::after {
          opacity: 1;
        }
        
        .circle-wrap {
          transform: scale(1.08);
          box-shadow: 0 0 30px var(--glow-color, rgba(0, 255, 255, 0.4));
        }
      }

      .circle-wrap {
        width: 72px;
        height: 72px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all 0.3s ease;
        position: relative;
        
        &::before {
          content: '';
          position: absolute;
          inset: -2px;
          border-radius: 50%;
          padding: 2px;
          background: var(--border-gradient);
          mask: linear-gradient(#fff 0 0) content-box, 
                linear-gradient(#fff 0 0);
          -webkit-mask-composite: xor;
          mask-composite: exclude;
          animation: rotate 4s linear infinite;
        }
        
        &::after {
          content: '';
          position: absolute;
          inset: 3px;
          border-radius: 50%;
          background: var(--inner-gradient);
          opacity: 0.4;
        }
        
        &.blue {
          --border-gradient: linear-gradient(135deg, #60A5FA, transparent);
          --inner-gradient: radial-gradient(circle at 30% 30%, #60A5FA, transparent);
          --glow-color: rgba(96, 165, 250, 0.4);
          --highlight-color: rgba(96, 165, 250, 0.6);
          background: rgba(37, 99, 235, 0.25);
        }
        
        &.warning {
          --border-gradient: linear-gradient(135deg, #FBBF24, transparent);
          --inner-gradient: radial-gradient(circle at 30% 30%, #FBBF24, transparent);
          --glow-color: rgba(251, 191, 36, 0.4);
          --highlight-color: rgba(251, 191, 36, 0.6);
          background: rgba(245, 158, 11, 0.25);
        }
        
        &.danger {
          --border-gradient: linear-gradient(135deg, #F87171, transparent);
          --inner-gradient: radial-gradient(circle at 30% 30%, #F87171, transparent);
          --glow-color: rgba(248, 113, 113, 0.4);
          --highlight-color: rgba(248, 113, 113, 0.6);
          background: rgba(239, 68, 68, 0.25);
        }

        .circle-value {
          font-size: 20px;
          font-weight: 600;
          color: #fff;
          text-shadow: 0 0 15px rgba(0, 255, 255, 0.6);
          position: relative;
          z-index: 1;
        }
      }

      .stat-info {
        flex: 1;
        
        .label {
          font-size: 18px;
          font-weight: 500;
          color: #fff;
          margin-bottom: 6px;
          text-shadow: 0 0 12px rgba(0, 255, 255, 0.4);
          position: relative;
          
          &::before {
            content: '';
            position: absolute;
            left: -10px;
            top: 50%;
            transform: translateY(-50%);
            width: 4px;
            height: 16px;
            background: var(--highlight-color, rgba(0, 255, 255, 0.6));
            border-radius: 2px;
            opacity: 0;
            transition: opacity 0.3s ease;
          }
        }
        
        .value {
          font-size: 15px;
          color: rgba(255, 255, 255, 0.7);
          transition: color 0.3s ease;
        }
      }
      
      &:hover {
        .stat-info {
          .label::before {
            opacity: 1;
          }
          .value {
            color: rgba(255, 255, 255, 0.9);
          }
        }
      }
    }
  }
  
  .ranking-chart {
    background: rgba(0, 20, 60, 0.85);
    border-radius: 16px;
    overflow: hidden;
    height: 100%;
    border: 1px solid rgba(0, 255, 255, 0.2);
    backdrop-filter: blur(12px);
    position: relative;
    box-shadow: 0 0 40px rgba(0, 150, 255, 0.15);
    
    &::before {
      content: '';
      position: absolute;
      inset: 0;
      background: linear-gradient(135deg,
        rgba(0, 255, 255, 0.15) 0%,
        transparent 50%
      );
      pointer-events: none;
    }
    
    .chart-title {
      padding: 20px 24px;
      font-size: 18px;
      font-weight: 500;
      color: #fff;
      text-shadow: 0 0 15px rgba(0, 255, 255, 0.5);
      background: rgba(0, 0, 0, 0.3);
      border-bottom: 1px solid rgba(0, 255, 255, 0.2);
      position: relative;
      
      &::after {
        content: '';
        position: absolute;
        left: 0;
        bottom: -1px;
        width: 100%;
        height: 1px;
        background: linear-gradient(90deg,
          transparent,
          rgba(0, 255, 255, 0.5),
          transparent
        );
      }
    }
  }
}

.center-group {
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-height: calc(100vh - 100px);
  
  .main-charts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    height: 65%;
    min-height: 0;
    
    .main-chart {
      background: rgba(0, 20, 60, 0.85);
      border-radius: 16px;
      padding: 24px;
      overflow: hidden;
      height: 100%;
      border: 1px solid rgba(0, 255, 255, 0.2);
      backdrop-filter: blur(12px);
      position: relative;
      box-shadow: 0 0 40px rgba(0, 150, 255, 0.15);
      
      &::before {
        content: '';
        position: absolute;
        inset: 0;
        background: linear-gradient(135deg,
          rgba(0, 255, 255, 0.15) 0%,
          transparent 50%
        );
        pointer-events: none;
      }
    }
  }
  
  .sub-charts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    height: 35%;
    min-height: 0;
    
    .pie-chart,
    .distribution-chart {
      background: rgba(0, 20, 60, 0.85);
      border-radius: 16px;
      padding: 24px;
      overflow: hidden;
      height: 100%;
      border: 1px solid rgba(0, 255, 255, 0.2);
      backdrop-filter: blur(12px);
      position: relative;
      box-shadow: 0 0 40px rgba(0, 150, 255, 0.15);
      
      &::before {
        content: '';
        position: absolute;
        inset: 0;
        background: linear-gradient(135deg,
          rgba(0, 255, 255, 0.15) 0%,
          transparent 50%
        );
        pointer-events: none;
      }
    }
  }
}

.right-group {
  display: grid;
  grid-template-rows: 1fr 1fr;
  gap: 24px;
  max-height: calc(100vh - 100px);
  
  .redlist-container,
  .blacklist-container {
    background: rgba(0, 20, 60, 0.85);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(0, 255, 255, 0.2);
    backdrop-filter: blur(12px);
    position: relative;
    box-shadow: 0 0 40px rgba(0, 150, 255, 0.15);
    
    &::before {
      content: '';
      position: absolute;
      inset: 0;
      border-radius: 16px;
      padding: 1.5px;
      background: linear-gradient(135deg, 
        rgba(0, 255, 255, 0.7),
        transparent 50%,
        rgba(0, 150, 255, 0.5)
      );
      mask: linear-gradient(#fff 0 0) content-box, 
            linear-gradient(#fff 0 0);
      -webkit-mask-composite: xor;
      mask-composite: exclude;
      pointer-events: none;
    }
    
    .panel-header {
      padding: 20px 24px;
      background: rgba(0, 0, 0, 0.3);
      border-bottom: 1px solid rgba(0, 255, 255, 0.2);
      display: flex;
      align-items: center;
      gap: 12px;
      position: relative;
      
      &::after {
        content: '';
        position: absolute;
        bottom: -1px;
        left: 0;
        width: 100%;
        height: 1px;
        background: linear-gradient(90deg,
          transparent,
          rgba(0, 255, 255, 0.5),
          transparent
        );
      }
      
      i {
        font-size: 18px;
      }
      
      span {
        font-size: 18px;
        font-weight: 500;
        color: #fff;
        text-shadow: 0 0 15px rgba(0, 255, 255, 0.5);
      }
    }
  }
}

.bottom-group {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  height: 320px;
  margin-top: 24px;
}

.chart-item {
  position: relative;
  
  &::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 12px;
    padding: 1.5px;
    background: linear-gradient(135deg, 
      rgba(0, 255, 255, 0.6),
      transparent 50%,
      rgba(0, 150, 255, 0.4)
    );
    mask: linear-gradient(#fff 0 0) content-box, 
          linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
  }
  
  &:hover::before {
    opacity: 1;
  }

  .chart-title {
    position: absolute;
    top: 20px;
    left: 20px;
    font-size: 16px;
    color: #fff;
    font-weight: 500;
    text-shadow: 0 0 15px rgba(0, 255, 255, 0.5);
    z-index: 1;
    
    &::before {
      content: '';
      position: absolute;
      left: -10px;
      top: 50%;
      transform: translateY(-50%);
      width: 4px;
      height: 16px;
      background: #0ff;
      border-radius: 2px;
      box-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
    }
  }
  
  .corner-tl,
  .corner-tr,
  .corner-bl,
  .corner-br {
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(0, 255, 255, 0.4);
    z-index: 2;
    
    &::before {
      content: '';
      position: absolute;
      width: 6px;
      height: 6px;
      background: rgba(0, 255, 255, 0.8);
      border-radius: 50%;
      box-shadow: 0 0 15px rgba(0, 255, 255, 0.6);
      animation: cornerPulse 2s ease-in-out infinite;
    }
  }
  
  .corner-tl {
    top: -2px;
    left: -2px;
    border-right: none;
    border-bottom: none;
    &::before {
      top: -2px;
      left: -2px;
    }
  }
  
  .corner-tr {
    top: -2px;
    right: -2px;
    border-left: none;
    border-bottom: none;
    &::before {
      top: -2px;
      right: -2px;
    }
  }
  
  .corner-bl {
    bottom: -2px;
    left: -2px;
    border-right: none;
    border-top: none;
    &::before {
      bottom: -2px;
      left: -2px;
    }
  }
  
  .corner-br {
    bottom: -2px;
    right: -2px;
    border-left: none;
    border-top: none;
    &::before {
      bottom: -2px;
      right: -2px;
    }
  }
}

@keyframes cornerPulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.5);
    opacity: 0.5;
  }
}

@keyframes scanline {
  0% {
    transform: translateY(-100%);
  }
  100% {
    transform: translateY(100%);
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 0.8;
  }
  50% {
    opacity: 0.6;
  }

}

@keyframes rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 1600px) {
  .main-content {
    grid-template-columns: 340px 1fr 340px;
    gap: 16px;
    padding: 16px;
  }
}

@media (max-width: 1366px) {
  .main-content {
    grid-template-columns: 320px 1fr 320px;
    gap: 14px;
    padding: 14px;
  }
}
</style>



